---
layout: example.html
title: Vector Labels
shortdesc: Example of GeoJSON features with labels.
docs: >
  This example showcases a number of options that can be set on text styles.
  When "Text/Wrap" is chosen (for example for the line features), the label is
  wrapped by inserting the character `\n`, which will create a multi-line
  label. The "Open Sans" web font will be loaded on demand, to show dynamic font
  loading.
tags: "geojson, vector, openstreetmap, label"
---
<div id="map" class="map"></div>

<div class="edit-form">
  <input id="refresh-points" type="button" value="Refresh" />
  <h2>Points</h2>
  <div class="edit-form-elem">
    <label>Text: </label>
    <select id="points-text">
      <option value="hide">Hide</option>
      <option value="normal">Normal</option>
      <option value="shorten" selected="selected">Shorten</option>
      <option value="wrap">Wrap</option>
    </select>
    <br />
    <label title="Max Resolution Denominator">MaxReso.:</label>
    <select id="points-maxreso">
      <option value="38400">38,400</option>
      <option value="19200">19,200</option>
      <option value="9600">9,600</option>
      <option value="4800">4,800</option>
      <option value="2400">2,400</option>
      <option value="1200" selected="selected">1,200</option>
      <option value="600">600</option>
      <option value="300">300</option>
      <option value="150">150</option>
      <option value="75">75</option>
      <option value="32">32</option>
      <option value="16">16</option>
      <option value="8">8</option>
    </select>
    <br />
    <label>Align: </label>
    <select id="points-align">
      <option value="center" selected="selected">Center</option>
      <option value="end">End</option>
      <option value="left">Left</option>
      <option value="right">Right</option>
      <option value="start">Start</option>
    </select>
    <br />
    <label>Baseline: </label>
    <select id="points-baseline">
      <option value="alphabetic">Alphabetic</option>
      <option value="bottom">Bottom</option>
      <option value="hanging">Hanging</option>
      <option value="ideographic">Ideographic</option>
      <option value="middle" selected="selected">Middle</option>
      <option value="top">Top</option>
    </select>
    <br />
    <label>Rotation: </label>
    <select id="points-rotation">
      <option value="0">0°</option>
      <option value="0.785398164">45°</option>
      <option value="1.570796327">90°</option>
    </select>
    <br />
    <label>Font: </label>
    <select id="points-font">
      <option value="Arial" selected="selected">Arial</option>
      <option value="'Courier New'">Courier New</option>
      <option value="'Open Sans'">Open Sans</option>
      <option value="Verdana">Verdana</option>
    </select>
    <br />
    <label>Weight: </label>
    <select id="points-weight">
      <option value="bold">Bold</option>
      <option value="normal" selected="selected">Normal</option>
    </select>
    <br />
    <label>Placement: </label>
    <select disabled id="points-placement">
      <option value="line">Line</option>
      <option value="point" selected="selected">Point</option>
    </select>
    <br />
    <label>Max Angle: </label>
    <select disabled id="points-maxangle">
      <option value="0.7853981633974483" selected="selected">45°</option>
      <option value="2.0943951023931953">120°</option>
      <option value="6.283185307179586">360°</option>
    </select>
    <br />
    <label>Exceed Len: </label>
    <select disabled id="points-overflow">
      <option value="true">True</option>
      <option value="false" selected="selected">False</option>
    </select>
    <br />
    <label>Size: </label>
    <input type="text" value="12px" id="points-size" />
    <br />
    <label>Line height: </label>
    <input type="text" value="1" id="points-height" />
    <br />
    <label>Offset X:</label>
    <input type="text" value="0" id="points-offset-x" />
    <br />
    <label>Offset Y:</label>
    <input type="text" value="0" id="points-offset-y" />
    <br />
    <label>Color :</label>
    <input type="text" value="#aa3300" id="points-color" />
    <br />
    <label title="Outline Color">O. Color:</label>
    <input type="text" value="#ffffff" id="points-outline" />
    <br />
    <label title="Outline Width">O. Width :</label>
    <input type="text" value="3" id="points-outline-width" />
  </div>
</div>

<div class="edit-form">
  <input id="refresh-lines" type="button" value="Refresh" />
  <h2>Lines</h2>
  <div class="edit-form-elem">
    <label>Text: </label>
    <select id="lines-text">
      <option value="hide">Hide</option>
      <option value="normal">Normal</option>
      <option value="shorten">Shorten</option>
      <option value="wrap" selected="selected">Wrap</option>
    </select>
    <br />
    <label title="Max Resolution Denominator">MaxReso.:</label>
    <select id="lines-maxreso">
      <option value="38400">38,400</option>
      <option value="19200">19,200</option>
      <option value="9600">9,600</option>
      <option value="4800">4,800</option>
      <option value="2400">2,400</option>
      <option value="1200" selected="selected">1,200</option>
      <option value="600">600</option>
      <option value="300">300</option>
      <option value="150">150</option>
      <option value="75">75</option>
      <option value="32">32</option>
      <option value="16">16</option>
      <option value="8">8</option>
    </select>
    <br />
    <label>Align: </label>
    <select id="lines-align">
      <option value="" selected="selected"></option>
      <option value="center">Center</option>
      <option value="end">End</option>
      <option value="left">Left</option>
      <option value="right">Right</option>
      <option value="start">Start</option>
    </select>
    <br />
    <label>Baseline: </label>
    <select id="lines-baseline">
      <option value="alphabetic">Alphabetic</option>
      <option value="bottom">Bottom</option>
      <option value="hanging">Hanging</option>
      <option value="ideographic">Ideographic</option>
      <option value="middle" selected="selected">Middle</option>
      <option value="top">Top</option>
    </select>
    <br />
    <label>Rotation: </label>
    <select id="lines-rotation">
      <option value="0">0°</option>
      <option value="0.785398164">45°</option>
      <option value="1.570796327">90°</option>
    </select>
    <br />
    <label>Font: </label>
    <select id="lines-font">
      <option value="Arial">Arial</option>
      <option value="'Courier New'" selected="selected">Courier New</option>
      <option value="'Open Sans'">Open Sans</option>
      <option value="Verdana">Verdana</option>
    </select>
    <br />
    <label>Weight: </label>
    <select id="lines-weight">
      <option value="bold" selected="selected">Bold</option>
      <option value="normal">Normal</option>
    </select>
    <br />
    <label>Placement: </label>
    <select id="lines-placement">
      <option value="line">Line</option>
      <option value="point" selected="selected">Point</option>
    </select>
    <br />
    <label>Max Angle: </label>
    <select id="lines-maxangle">
      <option value="0.7853981633974483" selected="selected">45°</option>
      <option value="2.0943951023931953">120°</option>
      <option value="6.283185307179586">360°</option>
    </select>
    <br />
    <label>Exceed Len: </label>
    <select id="lines-overflow">
      <option value="true">True</option>
      <option value="false" selected="selected">False</option>
    </select>
    <br />
    <label>Size: </label>
    <input type="text" value="12px" id="lines-size" />
    <br />
    <label>Line height: </label>
    <input type="text" value="1.2" id="lines-height" />
    <br />
    <label>Offset X:</label>
    <input type="text" value="0" id="lines-offset-x" />
    <br />
    <label>Offset Y:</label>
    <input type="text" value="0" id="lines-offset-y" />
    <br />
    <label>Color :</label>
    <input type="text" value="green" id="lines-color" />
    <br />
    <label title="Outline Color">O. Color:</label>
    <input type="text" value="#ffffff" id="lines-outline" />
    <br />
    <label title="Outline Width">O. Width :</label>
    <input type="text" value="3" id="lines-outline-width" />
  </div>
</div>

<div class="edit-form">
  <input id="refresh-polygons" type="button" value="Refresh" />
  <h2>Polygons</h2>
  <div class="edit-form-elem">
    <label>Text: </label>
    <select id="polygons-text">
      <option value="hide">Hide</option>
      <option value="normal" selected="selected">Normal</option>
      <option value="shorten">Shorten</option>
      <option value="wrap">Wrap</option>
    </select>
    <br />
    <label title="Max Resolution Denominator">MaxReso.:</label>
    <select id="polygons-maxreso">
      <option value="38400">38,400</option>
      <option value="19200">19,200</option>
      <option value="9600">9,600</option>
      <option value="4800">4,800</option>
      <option value="2400">2,400</option>
      <option value="1200" selected="selected">1,200</option>
      <option value="600">600</option>
      <option value="300">300</option>
      <option value="150">150</option>
      <option value="75">75</option>
      <option value="32">32</option>
      <option value="16">16</option>
      <option value="8">8</option>
    </select>
    <br />
    <label>Align: </label>
    <select id="polygons-align">
      <option value="" selected="selected"></option>
      <option value="center">Center</option>
      <option value="end">End</option>
      <option value="left">Left</option>
      <option value="right">Right</option>
      <option value="start">Start</option>
    </select>
    <br />
    <label>Baseline: </label>
    <select id="polygons-baseline">
      <option value="alphabetic">Alphabetic</option>
      <option value="bottom">Bottom</option>
      <option value="hanging">Hanging</option>
      <option value="ideographic">Ideographic</option>
      <option value="middle" selected="selected">Middle</option>
      <option value="top">Top</option>
    </select>
    <br />
    <label>Rotation: </label>
    <select id="polygons-rotation">
      <option value="0">0°</option>
      <option value="0.785398164">45°</option>
      <option value="1.570796327">90°</option>
    </select>
    <br />
    <label>Font: </label>
    <select id="polygons-font">
      <option value="Arial">Arial</option>
      <option value="'Courier New'">Courier New</option>
      <option value="'Open Sans'">Open Sans</option>
      <option value="Verdana" selected="selected">Verdana</option>
    </select>
    <br />
    <label>Weight: </label>
    <select id="polygons-weight">
      <option value="bold" selected="selected">Bold</option>
      <option value="normal">Normal</option>
    </select>
    <br />
    <label>Placement: </label>
    <select id="polygons-placement">
      <option value="line">Line</option>
      <option value="point" selected="selected">Point</option>
    </select>
    <br />
    <label>Max Angle: </label>
    <select id="polygons-maxangle">
      <option value="0.7853981633974483" selected="selected">45°</option>
      <option value="2.0943951023931953">120°</option>
      <option value="6.283185307179586">360°</option>
    </select>
    <br />
    <label>Exceed Len: </label>
    <select id="polygons-overflow">
      <option value="true">True</option>
      <option value="false" selected="selected">False</option>
    </select>
    <br />
    <label>Size: </label>
    <input type="text" value="10px" id="polygons-size" />
    <br />
    <label>Line height: </label>
    <input type="text" value="1" id="polygons-height" />
    <br />
    <label>Offset X:</label>
    <input type="text" value="0" id="polygons-offset-x" />
    <br />
    <label>Offset Y:</label>
    <input type="text" value="0" id="polygons-offset-y" />
    <br />
    <label>Color :</label>
    <input type="text" value="blue" id="polygons-color" />
    <br />
    <label title="Outline Color">O. Color:</label>
    <input type="text" value="#ffffff" id="polygons-outline" />
    <br />
    <label title="Outline Width">O. Width :</label>
    <input type="text" value="3" id="polygons-outline-width" />
  </div>
</div>
<div class="clearall"></div>
